import os
import yaml


# 读取
def read_yaml(yaml_name):
    with open(os.getcwd()+'/testcase/test_ceshi/'+yaml_name, mode='r', encoding='utf-8') as f:
        value = yaml.load(stream=f, Loader=yaml.FullLoader)
        return value


# 写入
def write_yaml(data, yaml_name):
    with open(os.getcwd()+'/testcase/test_ceshi/'+yaml_name, mode='a', encoding='utf-8') as f:
        yaml.dump(data, stream=f, allow_unicode=True)


# 清空
def clear_yaml(yaml_name):
    with open(os.getcwd()+'/testcase/test_ceshi/'+yaml_name, mode='w', encoding='utf-8') as f:
        f.truncate()
